
package com.ami.kvm.jviewer.soc;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import com.ami.kvm.jviewer.common.ISOCFrameHdr;
import com.ami.kvm.jviewer.soc.video.VideoEngineInfo;
import com.ami.kvm.jviewer.soc.video.VideoHeader;

public class SOCFrameHdr implements ISOCFrameHdr {
	public static final int FRAME_TYPE_UNKNOWN = -1;
	public static short width;
	public static short height;
	public short resX;
	public short resY;
	public byte[] m_compressedBuf;
	private VideoHeader videoHdr;
	private VideoEngineInfo videoEngInfo;
	public int frameSize;

	public SOCFrameHdr() {
		this.videoHdr = new VideoHeader();
		this.videoEngInfo = new VideoEngineInfo();
	}

	public void setHeader(ByteBuffer paramByteBuffer) {
		this.m_compressedBuf = this.videoHdr.set(paramByteBuffer);

		int i = paramByteBuffer.limit();
		if (i == 86) {
			setFrameSize(paramByteBuffer);
		}
	}

	public byte[] getCompressedBuf() {
		return this.m_compressedBuf;
	}

	public int getFrameType() {
		return -1;
	}

	public VideoEngineInfo getFrameVariables() {
		this.videoEngInfo.SourceModeInfo.X = this.videoHdr.SourceMode_X;
		this.videoEngInfo.SourceModeInfo.Y = this.videoHdr.SourceMode_Y;

		this.videoEngInfo.DestinationModeInfo.X = this.videoHdr.DestinationMode_X;
		this.videoEngInfo.DestinationModeInfo.Y = this.videoHdr.DestinationMode_Y;
		this.videoEngInfo.CompressData.CompressSize = this.videoHdr.CompressData_CompressSize;
		this.videoEngInfo.FrameHeader.RC4Enable = this.videoHdr.FrameHdr_RC4Enable;
		this.videoEngInfo.FrameHeader.RC4Reset = this.videoHdr.FrameHdr_RC4Reset;
		this.videoEngInfo.FrameHeader.Mode420 = this.videoHdr.Mode420;
		this.videoEngInfo.FrameHeader.JPEGScaleFactor = this.videoHdr.FrameHdr_JPEGScaleFactor;
		this.videoEngInfo.FrameHeader.NumberOfMB = this.videoHdr.FrameHdr_NumberOfMB;
		this.videoEngInfo.FrameHeader.AdvanceScaleFactor = this.videoHdr.FrameHdr_AdvanceScaleFactor;
		this.videoEngInfo.FrameHeader.JPEGTableSelector = this.videoHdr.FrameHdr_JPEGTableSelector;
		this.videoEngInfo.FrameHeader.AdvanceTableSelector = this.videoHdr.FrameHdr_AdvanceTableSelector;
		this.videoEngInfo.FrameHeader.JPEGYUVTableMapping = this.videoHdr.FrameHdr_JPEGYUVTableMapping;
		this.videoEngInfo.FrameHeader.SharpModeSelection = this.videoHdr.FrameHdr_SharpModeSelection;
		this.videoEngInfo.FrameHeader.CompressionMode = this.videoHdr.FrameHdr_CompressionMode;
		this.videoEngInfo.INFData.DownScalingMethod = this.videoHdr.InfData_DownScalingMethod;
		this.videoEngInfo.INFData.DifferentialSetting = this.videoHdr.InfData_DifferentialSetting;
		this.videoEngInfo.INFData.AnalogDifferentialThreshold = this.videoHdr.InfData_AnalogDifferentialThreshold;
		this.videoEngInfo.INFData.DigitalDifferentialThreshold = this.videoHdr.InfData_DigitalDifferentialThreshold;
		this.videoEngInfo.INFData.AutoMode = this.videoHdr.InfData_AutoMode;
		this.videoEngInfo.INFData.VQMode = this.videoHdr.InfData_VQMode;

		this.resX = this.videoEngInfo.DestinationModeInfo.X;
		this.resY = this.videoEngInfo.DestinationModeInfo.Y;
		width = this.videoEngInfo.DestinationModeInfo.X;
		height = this.videoEngInfo.DestinationModeInfo.Y;

		return this.videoEngInfo;
	}

	public short getresX() {
		return this.resX;
	}

	public short getresY() {
		return this.resY;
	}

	public short getwidth() {
		return width;
	}

	public short getheight() {
		return height;
	}

	public short getcurwidth() {
		return width;
	}

	public short getcurheight() {
		return height;
	}

	public int getFrameHeadersize() {
		return 86;
	}

	public int getFrameSize() {
		return this.frameSize;
	}

	private void setFrameSize(ByteBuffer paramByteBuffer) {
		int[] arrayOfInt = new int[2];

		paramByteBuffer.rewind();
		paramByteBuffer.order(ByteOrder.LITTLE_ENDIAN);

		int i = paramByteBuffer.getShort();
		int j = paramByteBuffer.getShort();

		int k = paramByteBuffer.getShort();
		int m = paramByteBuffer.getShort();
		int n = paramByteBuffer.getShort();
		int i1 = paramByteBuffer.getShort();
		int i2 = paramByteBuffer.get();

		int i3 = paramByteBuffer.getShort();
		int i4 = paramByteBuffer.getShort();
		int i5 = paramByteBuffer.getShort();
		int i6 = paramByteBuffer.getShort();
		int i7 = paramByteBuffer.get();

		int i8 = paramByteBuffer.getInt();
		int i9 = paramByteBuffer.getInt();
		int i10 = paramByteBuffer.getShort();
		int i11 = paramByteBuffer.getShort();
		arrayOfInt[0] = paramByteBuffer.getInt();
		arrayOfInt[1] = paramByteBuffer.getInt();
		int i12 = paramByteBuffer.get();
		int i13 = paramByteBuffer.get();
		int i14 = paramByteBuffer.get();
		int i15 = paramByteBuffer.get();
		int i16 = paramByteBuffer.get();
		int i17 = paramByteBuffer.get();
		int i18 = paramByteBuffer.get();
		int i19 = paramByteBuffer.getInt();
		int i20 = paramByteBuffer.get();
		int i21 = paramByteBuffer.get();
		int i22 = paramByteBuffer.get();

		int i23 = paramByteBuffer.get();
		int i24 = paramByteBuffer.get();
		int i25 = paramByteBuffer.getShort();
		int i26 = paramByteBuffer.getShort();
		int i27 = paramByteBuffer.get();
		int i28 = paramByteBuffer.get();
		int i29 = paramByteBuffer.get();

		int i30 = paramByteBuffer.getInt();
		int i31 = paramByteBuffer.getInt();
		int i32 = paramByteBuffer.getInt();
		int i33 = paramByteBuffer.getInt();

		int i34 = paramByteBuffer.get();
		int i35 = paramByteBuffer.getShort();
		int i36 = paramByteBuffer.getShort();

		this.frameSize = i31;
	}
}

/*
 * Location:
 * D:\Users\tianlin\Downloads\JViewer-SOC.jar!\com\ami\kvm\jviewer\soc\
 * SOCFrameHdr.class Java compiler version: 5 (49.0) JD-Core Version: 0.7.1
 */